form_edit = jq('form[name=form_edit_schema_name]').get(0)
function SelectItem(row_id){
    var table_row_element = jq('#' + row_id).get();
    cells = table_row_element[0].cells
    check = jq('.check_schema_name)[value=' + row_id + ']').get(0)
    check.checked = !check.checked

    for (var i=0; i<cells.length; i++){
        name_column = String.replace(cells[i].id,'view', '')
        edit_column = jq('#edit'+name_column).get(0)
        if (edit_column){
            if (edit_column.type=='text') 
                edit_column.value=cells[i].innerHTML;
            else if (edit_column.type=='textarea') 
                edit_column.innerHTML=cells[i].innerHTML
        }
    }
    form_edit.elements['action'].value = 'edit'
    jq('input.primary_key[name=id]').get(0).value = row_id
}

jq(document).ready(function(){
   jq("#btnDelete").click(function(event){
     jq('#action').get(0).value = 'delete'
     jq('form[name=form_edit_schema_name]').get(0).submit()
   });
});
jq(document).ready(function(){
   jq("#btnNovo").click(function(event){
     jq('#action').get(0).value = 'new'
     jq('form[name=form_edit_schema_name]').get(0).submit()
   });
});

jq(document).ready(function(){
   jq("#check_all").click(function(event){
     check_all = jq("#check_all").get(0)
     if (check_all){
        checks = jq('.check_schema_name').get()
        for (var i=0;i<checks.length;i++)
            checks[i].checked = check_all.checked
     }
   });
});

